package com.yl.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public enum CdcOperation {

    R("r", "read"),
    C("c", "create"),
    U("u", "update"),
    D("d", "delete");

    private String op;
    private String operation;

    /**
     * 根据操作类型获取对应的 CdcOperation
     */
    public static CdcOperation getByOp(String op) {
        for (CdcOperation co : CdcOperation.values()) {
            if (co.op.equals(op)) {
                return co;
            }
        }
        return null;
    }

}

